const Koa = require('koa')
const app = new Koa()
const router = require('koa-route')

const main = ctx => {
ctx.response.body = 'hello world'
}
const about = ctx => {
    ctx.response.type = 'html'
    ctx.response.body = '<a href="/">About</a>'
}

// app.use(main)
app.use(router.get('/',main))  // 定义接口api
app.use(router.get('/about',about))

app.listen(3000,() => {
    console.log('项目已启动');
})